package ewgenius.xube.engine.entities.primitives;

import static org.lwjgl.opengl.GL11.GL_LINES;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glColor3f;
import static org.lwjgl.opengl.GL11.glVertex3d;

import ewgenius.xube.engine.graphics.*;
import static ewgenius.xube.engine.physics.PhysicsEngine.*;

import ewgenius.xube.engine.entities.Entity;

public class Plane extends Entity {

	private int size = 1000;
	float diameter = 0.1f * meter;
	
	public Plane() {
		super("plane", 0);
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public void render(Render render) {
		
		render.beginModelRender(position, rotation);
		
		glBegin(GL_LINES);
		glColor3f(0.5f, 0.5f, 0.5f);

		for (float i = -size; i <= size; i += 1) {
			glVertex3d(position.x + i * diameter, position.y, position.z - size
					* diameter);
			glVertex3d(position.x + i * diameter, position.y, position.z + size
					* diameter);
			glVertex3d(position.x - size * diameter, position.y, position.z + i
					* diameter);
			glVertex3d(position.x + size * diameter, position.y, position.z + i
					* diameter);
		}
		
		render.endModelRender();
	}

}
